<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
      }
      #d1 {
        /* 绝对定位 相对于窗口或某一个上级元素做偏移 脱离文档流 后面的元素会顶上来 */
        position: absolute;
        top: 0;
        left: 0;
      }
      #d2 {
        width: 200px;
        height: 200px;
        background-color: red;
        margin: 100px 0 0 100px;
        position: relative;
      }
      #d2 > div {
        width: 100px;
        height: 100px;
        margin: 50px 0 0 50px;
        background-color: blue;
        /* position: relative; */
      }
      #d2 > div > div {
        width: 50px;
        height: 50px;
        background-color: green;
        position: absolute;
        top: 0;
        left: 0;
      }
    </style>
  </head>
  <body>
    <div id="d2">
      <div>
        <div></div>
      </div>
    </div>
    <div id="d1">div1</div>
    <div>div2</div>
    <div>div3</div>
  </body>
</html>
